<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href="style.css" rel="stylesheet" type="text/css" media = "screen">
<link href="print.css" rel="stylesheet" type="text/css" media = "print">

</head>
<body>
<div id = "wrapper">

<div id = "container">
	<h1 class = "header">การประเมินตนเอง</h1>
	<br>
	
	{if="$assessment['id'] != ''"}
	<div class = "center" id = "assessment">
		<button class="print"  onclick="javascript:window.print()">พิมพ์รายงาน</button>
		<form action = "assessment-update.php" method = "post">
		<input type = "hidden" name = "id" value = "{$assessment['id']}">
		<input type = "hidden" name = "result" value = "{$assessment['result']}">

		<table cellpadding = "0" cellspacing = "0" border = "0" class = "list" id = "main">
			<tr>
				<th>หัวข้อ</th>
				<th>รายละเอียด</th>
			</tr>
			<tr>
				<td class = "head">หลักการ</td>
			{if="$user['level_name']=='officer'"}
				<td><textarea name = "principle" class = "col2">{$assessment['principle']}</textarea></td>
			{else}
				<td class="col2">{$assessment['principle']}</td>
			{/if}
			</tr>
			<tr>
				<td class = "head">มาตรฐานที่เกียวข้อง</td>
			{if="$user['level_name']=='officer'"}
				<td><textarea name = "related" class="col2">{$assessment['related']}</textarea></td>
			{else}
				<td class="col2">{$assessment['related']}</td>
			{/if}
			</tr>
			<tr>
				<td class = "head">ตัวบ่งชี้ {$assessment['gid']}.{$assessment['sub']}</td>
			{if="$user['level_name']=='officer'"}
				<td><input type = "text" name = "name" value = "{$assessment['name']}"></td>
			{else}
				<td>{$assessment['name']}</td>
			{/if}
			</tr>
			<tr>
				<td class = "head">ชนิดของตัวบ่งชี้</td>
			{if="$user['level_name']=='officer'"}
				<td>
					<select name = 'type'>
						<option value = '1' {if="$assessment['type']==1"} selected {/if}>กระบวนการ</option>
						<option value = '2' {if="$assessment['type']==2"} selected {/if}>ปัจจัยนำเข้า</option>
					</select>
				</td>
			{else}
				<td>{if="$assessment['type']==1"} กระบวนการ {else} ปัจจัยนำเข้า {/if}</td>
			{/if}
			</tr>
			<tr>
				<td class = "head">เกณฑ์การประเมิน</td>
				<td>
					<table cellpadding = "0" cellspacing = "0" border = "0" class = "list" id = "point">
						<tr>
							<td class = "head">คะแนน 1</td>
							<td class = "head">คะแนน 2</td>
							<td class = "head">คะแนน 3</td>
							<td class = "head">คะแนน 4</td>
							<td class = "head">คะแนน 5</td>
						</tr>
						<tr>
						{if="$user['level_name']=='officer'"}
							<td><input type = "text" name = "p1" class = "w70" value = "{$assessment['p1']}"></td>
							<td><input type = "text" name = "p2" class = "w70" value = "{$assessment['p2']}"></td>
							<td><input type = "text" name = "p3" class = "w70" value = "{$assessment['p3']}"></td>
							<td><input type = "text" name = "p4" class = "w70" value = "{$assessment['p4']}"></td>
							<td><input type = "text" name = "p5" class = "w70" value = "{$assessment['p5']}"></td>
						{else}
							<td>มีการดำเนินการ {$assessment['p1']} ข้อ</td>
							<td>มีการดำเนินการ {$assessment['p2']} ข้อ</td>
							<td>มีการดำเนินการ {$assessment['p3']} ข้อ</td>
							<td>มีการดำเนินการ {$assessment['p4']} ข้อ</td>
							<td>มีการดำเนินการ {$assessment['p5']} ข้อ</td>
						{/if}
						</tr>
					</table>
				</td>
			</tr>
		</table>
		{if="$user['level_name']=='officer'"}<input type = "submit" value = " ตกลง ">{/if}
		</form>

		<br><br>

		{if="$assessment['type']==1"}
			{include="standard"}
		{else}
			{include="formula"}
		{/if}

		<div class = "col-left" {if="$user['level_name']=='officer'"} style = "display:none;" {/if}>

			<div class = "field" style = "position:absolute; top:0px;left:200px;">
				<img src="{$pass}">
			</div>
			<div class = "field">
				<span class = "head">ผลการดำเนินงาน</span><br>
				{if="$assessment['result'] == 0"}
					ยังไม่ได้ทำการประเมินตนเอง
				{else}
					{$assessment['result']}
				{/if}
			</div>
			<div class = "field">
				<span class = "head">เป้าหมาย </span><br>
				{if="$user['level_name']=='assessor'"}
				<input type = "text" name = "target" class = "w20" value = "{$assessment['target']}"><br>
				{else}
					{if="$assessment['target'] == 0"}
						ยังไม่ได้ทำการประเมินตนเอง
					{else}
						{$assessment['target']}
					{/if}
				{/if}
			</div>

			<div class = "field">
				<span class = "head">คะแนนประเมินตนเอง</span><br>
				{if="$assessment['evaluation'] == 0"}
					ยังไม่ได้ทำการประเมินตนเอง
				{else}
					{$assessment['evaluation']} คะแนน
				{/if}
			</div>

			<div class = "field">
				<span class = "head">ผู้กับกำดูแลตัวบ่งชี้</span><br>
				{if="$user['level_name']=='assessor'"}
				<input type = "text" name = "indicator" class = "w250" value = "{$assessment['indicator']}">
				{else}
					{if="$assessment['indicator'] == ''"}
						ยังไม่ได้ทำการประเมินตนเอง
					{else}
						{$assessment['indicator']}
					{/if}
				{/if}
			</div>

			<div class = "field">
				<span class = "head">ผู้เก็บรวบรวมข้อมูล</span><br>
				{if="$user['level_name']=='assessor'"}
					<input type = "text" name = "collector" class = "w250" value = "{$assessment['collector']}">
				{else}
					{if="$assessment['collector'] == ''"}
						ยังไม่ได้ทำการประเมินตนเอง
					{else}
						{$assessment['collector']}
					{/if}
				{/if}
			</div>

			<div class = "field">
				<span class = "head">โครงการ</span><br>
				{if="$user['level_name']=='assessor'"}
					<textarea  class = "w250 h100" name = "project">{$assessment['project']}</textarea>
				{else}
					{if="$assessment['project'] == ''"}
						ยังไม่ได้ทำการประเมินตนเอง
					{else}
						{$assessment['project']}
					{/if}
				{/if}
			</div>
			<br>
			{if="$user['level_name']=='assessor'"}
			<input type = "submit" value = "ตกลง">
			{/if}
		</div>
		</form>

		<div class = "col-right" {if="$user['level_name']=='officer'"} style = "display:none;" {/if}>
			<form action = "ext-update.php" method = "post">
				<input type = "hidden" name = "ext_user" value = "{$user['name']}">
				<input type = "hidden" name = "id" value = "{$assessment['id']}">
				<div class = "field">
					<span class = "head">คะแนนประเมินจากผู้ประเมินภายนอก</span><br>
					{if="$user['level_name']=='board'"}
						<input type = "text" name = "ext_evaluation" class = "w100" value = "{$assessment['ext_evaluation']}">
					{else}
						{if="$assessment['ext_evaluation'] == 0"}
							ยังไม่ได้ทำการประเมิน
						{else}
							{$assessment['ext_evaluation']}
						{/if}
					{/if}
				</div>

				<div class = "field">
					<span class = "head">ข้อเสนอแนะ</span><br>
					{if="$user['level_name']=='board'"}
						<textarea class = "w250 h100" name = "ext_comment">{$assessment['ext_comment']}</textarea>
					{else}
						{if="$assessment['ext_comment'] == ''"}
							ยังไม่ได้ทำการประเมิน
						{else}
							{$assessment['ext_comment']}
						{/if}
					{/if}
				</div>
				<div class = "field">
				<span class = "head">ชื่อผู้ประเมินภายนอก</span><br>
					{if="$assessment['ext_user'] == ''"}
						ยังไม่มีผู้ประเมิน
					{else}
						{$assessment['ext_user']}
					{/if}
				</div>
				<br>
				{if="$user['level_name']=='board'"}
					<input type = "submit" value = "ตกลง">
				{/if}
			</form>
		</div>

	</div>
	{/if}

	<div class = "clear"></div>
</div>

</div> <!-- wrapper -->

</body>
</html>